package com.sgcc.pda.util;

import android.content.Context;

import com.sgcc.pda.data.dao.KnowlsContentProviderDao;
import com.sgcc.pda.data.dao.impl.KnowlsContentProviderDaoImpl;
import com.sgcc.pda.data.entity.knowls.DiagsInfo;
import com.sgcc.pda.data.entity.knowls.KnowInfoResult;
import com.sgcc.pda.data.entity.knowls.RepairsInfo;

import java.util.List;

/**
 * 内容提供者工具类.
 *
 * @author 王沛栋
 * @data 2018/1/19 10:43
 */

public class KnowlsContentProviderUtil {
    private static KnowlsContentProviderDao knowlsContentProviderDao;

    private static KnowlsContentProviderDao getKnowlsContentProviderDao() {
        if (knowlsContentProviderDao == null) {
            knowlsContentProviderDao = new KnowlsContentProviderDaoImpl();
        }
        return knowlsContentProviderDao;
    }

    /**
     * @param context
     * @param value   ABN_TYPE，DEV_TYPE，（1异常原因信息，2参数校验信息，3外设信息显示）
     * @param appNo
     * @return
     */
    public static List<KnowInfoResult> findInfo(Context context, String[] value, String appNo) {
        return getKnowlsContentProviderDao().findInfo(context, value, appNo);
    }

    public static List<KnowInfoResult> findInfo(Context context, String abnType, String sblxbm, String inv_type) {
        return getKnowlsContentProviderDao().findInfo(context, abnType, sblxbm, inv_type);
    }

    public static List<KnowInfoResult> findAllInfo(Context context, String e_dev_code, String abn_type, String at_code) {
        return getKnowlsContentProviderDao().findAllInfo(context, e_dev_code, abn_type, at_code);
    }

    public static List<String> findAllGroupByResonName(Context context) {
        return getKnowlsContentProviderDao().findAllGroupByResonName(context);
    }

    public static List<DiagsInfo> findAllDiagsInfo(Context context, String code, String abnTYpe) {
        return getKnowlsContentProviderDao().findAllDiagsInfo(context, code, abnTYpe);
    }

    public static List<RepairsInfo> findAllRepairInfo(Context context, String code, String abnTYpe) {
        return getKnowlsContentProviderDao().findAllRepairInfo(context, code, abnTYpe);
    }

    public static int updateKnowResult(Context context, String[] selections) {
        return getKnowlsContentProviderDao().updateKnowResult(context, selections);
    }

    public static int updateKnowInfoResult(Context context, String[] selections) {
        return getKnowlsContentProviderDao().updateKnowInfoResult(context, selections);
    }

    public static int updateKnowInfoResultName(Context context, String[] selections) {
        return getKnowlsContentProviderDao().updateKnowInfoResultName(context, selections);
    }

    public static List<KnowInfoResult> findAllExceptional(Context context, String code, String appNo) {
        return getKnowlsContentProviderDao().findAllExceptional(context, code, appNo);
    }

    public static List<KnowInfoResult> findZGJCAll(Context context, String app_no, String inv_type) {
        return getKnowlsContentProviderDao().findZGJCAll(context, app_no, inv_type);
    }
}
